package com.xinfu.newproject.adapter.paycost_adapter;


import android.view.View;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.activity.PayCostActivity;
import com.xinfu.newproject.activity.PropertyActivity;
import com.xinfu.newproject.data.DataServer;
import com.xinfu.newproject.entity.Status;

/**
 * https://github.com/CymChad/BaseRecyclerViewAdapterHelper
 */
public class PayCostHeaderAdapter extends BaseQuickAdapter<Status, BaseViewHolder> {

    private RelativeLayout relativeLayout;

    public PayCostHeaderAdapter(int dataSize) {
        super(R.layout.item_paycost, DataServer.getSampleData(dataSize));
    }

    @Override
    protected void convert(BaseViewHolder helper, Status item) {
        relativeLayout = helper.getView(R.id.item_paycost_property_rl);
        switch (helper.getLayoutPosition() %
                2) {
            case 0:
                helper.setImageResource(R.id.item_paycost_property_icon, R.mipmap.car_pay_cost_icon);

                relativeLayout.setBackgroundResource(R.mipmap.car_pay_cost_bg);
                helper.setText(R.id.item_paycost_property_type, "车位费");
                break;
            case 1:
                helper.setImageResource(R.id.item_paycost_property_icon, R.mipmap.property_pay_cost_icon);
                relativeLayout.setBackgroundResource(R.mipmap.property_pay_cost_bg);
                helper.setText(R.id.item_paycost_property_type, "物业费");
                break;
            default:
                break;
        }

        relativeLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((PayCostActivity) mContext).startIntentActivity(PropertyActivity.class, null);
            }
        });


    }


}
